﻿@{
    Layout = null;
}<!DOCTYPE html>
<html>
<head>
    <title>管理登录-极简木材网站管理系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="Author" content="pageAdmin Cms,http://www.pageadmin.net" />
    <link rel="stylesheet" href="~/Incs/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/Areas/Admin/Css/login.css" type="text/css">
    <script src="/Js/jquery.min.js" type="text/javascript"></script>
    <script src="/Js/basic.js" type="text/javascript"></script>
    <script src="/Js/UI/ui.js" type="text/javascript"></script>
    <!--[if lte IE 9]>
    <script src="/Incs/bootstrap/js/respond.min.js"></script>
    <script src="/Incs/bootstrap/js/html5.js"></script>
    <![endif]-->
    <script src="/Incs/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
</head>
<body>
    <!--[if lte IE 9]>
      <div class="alert alert-warning text-center">
          <a href="#" class="close" data-dismiss="alert">
              &times;
          </a>
          <strong>您好！</strong> 您使用的IE浏览器版本过低，为了获取更好的浏览体验，建议你使用谷歌(chrome)，火狐(Firefox)等标准浏览器，或升级到IE10+以上版本！
      </div>
       <![endif]-->
    <div class="main clearfix">
            <div class="login-box" id="loginbox">
                    <form method="post" id="_form" class="" data-validate-params="tipsStyle:3" autocomplete="off">
                        <div class="login-title">管理登录</div>
                        <div class="validate-all-tips-box"></div>
                        <div class="form-group">
                            <div class="controls ">
                                <input type="text" id="username" name="username" class="form-control" maxlength="50" placeholder="管理员账户" data-validate="dataType:'*',nullMsg:'请填写管理员账户!'">
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                <input type="password" id="password" name="password" class="form-control" maxlength="50" placeholder="密码" data-validate="dataType:'password',nullMsg:'请填写密码!'">
                                <span class="help-block"></span>
                            </div>
                        </div>
                        @{
                        string AuthenticationCode = Model;

                        if (!string.IsNullOrWhiteSpace(AuthenticationCode))
                        {
                                <div class="form-group">
                                    <div class="controls">
                                        <input type="text" id="code" name="code" class="form-control" maxlength="50" placeholder="认证码" data-validate="dataType:'*',nullMsg:'请填写认证码!'">
                                        <span class="help-block"></span>
                                    </div>
                                </div>
                        }
                        }

                        <div class="form-group">
                            <div class="controls">
                                <div class="input-group">
                                    <input type="text" id="_VerificationCode" name="_VerificationCode" class="form-control" maxlength="4" placeholder="输入验证码" data-validate="dataType:'*',minLength:4,minLengthErrorMsg:'验证码最少4个字符',nullMsg:'请填写验证码',checkUrl:'/E/VerificationCode/Validate',checkError:'验证码填写错误'">
                                    <span class="input-group-btn">
                                        <a class="btn btn-default btn-sm btn-verificationCodeImg"><img id="verificationCodeImg" src="/E/VerificationCode/?width=100&amp;height=38" class="ui-verificationCodeImage" style="cursor: pointer;"></a>
                                    </span>
                                </div>
                                <span class="help-block" id="_ValidateTips__VerificationCode"></span>
                            </div>
                        </div>

                        <div class="form-group remark">
                            <div class="controls clearfix">
                                <input id="cookies" type="checkbox" name="cookies" value="1"> <label for="cookies">&nbsp;保存信息</label>
                                <a href="/" class="pull-right" target="_blank">返回首页</a>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="controls">
                                @Html.AntiForgeryToken()
                                <button type="button" class="btn btn-info col-xs-12 ui-pagePost" data-custom-params="url:'@Url.ActionUrl()',failCallBack:'FailCallBack',callBack:'LoginSuccess',successMsg:''">登录</button>
                            </div>
                        </div>
                    </form>
                <div class="footer"></div>
                <div class="copyright"><a href="http://www.pageadmin.net" target="_pageadmin"> 极简木材网站管理系统 &copy 版权所有</a></div>
            </div>

            </div>

    <script type="text/javascript">

        if (self != top) { top.location = self.location; }
        var $form = $("#_form");
        var $verificationCode = $("#verificationCode");

        function SaveInfo() {
            if ($("#cookies").prop("checked")) {
                var serializerStr = $form.SerializeJson();
                serializerStr = JsonToString(serializerStr);
                SetLocalStorage("LoginAdminUserInfo", serializerStr);
            }
            else {
                RemoveLocalStorage("LoginAdminUserInfo");
            }
        }
        //初始化登录信息
        function InitLoginInfo() {
            var serializerStr = GetLocalStorage("LoginAdminUserInfo");
            $form.FormBind({}, serializerStr);
            $verificationCode.val("");
        }
        InitLoginInfo();

        
        function Init() {
            var bgNum = Math.floor(Math.random() * 5 + 1);
            $("body").css("background-image", "url(/Areas/Admin/Css/images/login/" + bgNum + ".jpg)");
            var winHeight = $(window).height();
            var $intro = $(".intro")
            var $loginBox = $("#loginbox");
            var introHeight = $intro.height();
            var mHeight = $loginBox.height();
            var topIntroMargin = parseInt(winHeight / 2) - parseInt(introHeight / 2) - 40;
            var topMargin = parseInt(winHeight / 2) - parseInt(mHeight / 2) - 40;
            $intro.css("margin-top", topIntroMargin + "px");
            $loginBox.css("margin-top", topMargin + "px");
            $intro.fadeIn("slow");
            //$("#loginbox").animate({ opacity: "10" }, 2000);
        }
        $(function () {
            Init();
        });

        var $tipsBox = $form.find(".validate-all-tips-box");
        function FailCallBack(data) {
            var msg = data.Msg;
            $tipsBox.html(msg);
        }
        function LoginSuccess() {
            layer.msg('登录成功...', {
                icon: 16,
                time: 200000, //200秒
                shade: 0.01
            });
            SaveInfo();
            location.href = "@(Url.ActionUrl("index","Default"))";
        }
        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                $(".ui-pagePost").trigger("click");
            }
        });
    </script>
</body>
</html>